Chris Pollett > Old Classes >
CS154

( Print View )

Student Corner:
  [Grades Sec3]

  [Submit Sec3]

  [Class Sign up Sec3]

  [
Lecture Notes]

  [Discussion Board]

  [Announcements]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                           












CS154 Spring 2007Practice Midterm 2

To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems. (2) Go over your notes at least three times. Second and third time try to see how much you can remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you want to study in groups, at this point you are ready to quiz each other. The practice midterm is below. Here are some facts about the actual midterm: (a) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (b) You should bring photo ID. (c) There will be more than one version of the test. Each version will be of comparable difficulty. (d) One problem (less typos) on the actual test will be from the practice test.

[Student Generated Solutions][Student JFLAP for Problem9]

1. Let G be a simple grammar. Prove that if w is in L(G) then any string generated in a leftmost derivation of w has length ≤ |w|.

2. Give an algorithm which when supplied a CFG G outputs an equivalent CFG without useless productions or variables.

3. Given an example of a CFG which is in Chomsky Normal Form but is not in Greibach Normal Form. Similarly, give an example grammar which is Greibach normal form but not Chomsky normal form. Explain your answer.

4. Consider the grammar A--> AB | a, B--> AA. Show the tables the CYK algorithm would compute at each step of determining if the string aaaaa is in the language of this grammar.

5. Convert the grammar of problem 4 to a PDA using the algorithm from class.

6. Give the definition of what is a DCFL. Prove that {anbn | n ≥ 0} is DCFL.

7. Briefly explain why or why not the construction in the book to convert a PDA to a CFG with the same language yields a CFG in Greibach Normal Form.

8. Prove that the language {anbmcn+m| n,m≥0} is DCFL. Then prove that the language {anbmcn*m| n,m≥0} is not context free.

9. Give a TM for the first language of Problem 8.

10. Give the formal definition of what it means for a TM to accept a string. Then give an example which illustrates how this definition.